package cn.iocoder.yudao.module.myerp.dal.mysql.SKUproduct;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.myerp.dal.dataobject.SKUproduct.ErpProductSkuDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.myerp.controller.admin.SKUproduct.vo.*;

/**
 * ERP SKU级产品 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ErpProductSkuMapper extends BaseMapperX<ErpProductSkuDO> {

    default PageResult<ErpProductSkuDO> selectPage(ErpProductSkuPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ErpProductSkuDO>()
                .eqIfPresent(ErpProductSkuDO::getId, reqVO.getId())
                .likeIfPresent(ErpProductSkuDO::getSpu, String.valueOf(reqVO.getSpu()))
                .likeIfPresent(ErpProductSkuDO::getSkc, String.valueOf(reqVO.getSkc()))
                .likeIfPresent(ErpProductSkuDO::getSku, String.valueOf(reqVO.getSku()))
                .eqIfPresent(ErpProductSkuDO::getShopId, reqVO.getShopId())
                .likeIfPresent(ErpProductSkuDO::getName, reqVO.getName())
                .eqIfPresent(ErpProductSkuDO::getBarCode, reqVO.getBarCode())
                .orderByDesc(ErpProductSkuDO::getId));
    }

}